import 'package:baselib/util/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';

Widget getNormalPage(
    {bool isSetDark = true,
      @required Widget child}) {
  return AnnotatedRegion(
      value: isSetDark ? SystemUiOverlayStyle.dark : SystemUiOverlayStyle.light,
      child: Material(
        color: Colors.white,
        child: child,
      ));
}

Widget buildAppBar(BuildContext contex, String title) {
  return new AppBar(
      backgroundColor: Colors.white,
      leading: new IconButton(
          icon: Image.asset(
            CommonUtils.getImgPath("icon_back_black.png"),
            width: 19,
            height:32,
          ),
          onPressed: () {
            Get.back();
          }),
      title: new Text(title,
          style: TextStyle(
              fontSize: 20,
              color: Colors.black,
              decoration: TextDecoration.none)),
      centerTitle: true);
}

Widget switchStatusBar2DarkAppbar({
  @required BuildContext context,
  String title = "",
  @required Widget child,
}) {
  return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.dark,
      child: Material(
        child: new Scaffold(
          backgroundColor: Colors.white,
          appBar: new AppBar(
              brightness: Brightness.light,
              backgroundColor: Colors.white,
              leading: new IconButton(
                  icon: Image.asset(
                    CommonUtils.getImgPath("icon_back_black.png"),
                    width: 19,
                    height: 32,
                  ),
                  onPressed: () {
                    Get.back();
                  }),
              title: new Text(title,
                  style: TextStyle(
                      fontSize: 20,
                      color: Colors.black,
                      decoration: TextDecoration.none)),
              centerTitle: true),
          body: child,
        ),
      ));
}